#include "itemitem.h"

ItemItem::ItemItem(QObject *parent) :
    QObject(parent)
{
}

ItemItem::ItemItem(int itemId, QString name, Grupa group, int index, bool isAGroup, int groupNumber){
    m_ItemId=itemId;
    m_name=name;
    m_GroupId=group.dajId();
    m_GroupName=group.dajImeGrupe();
    m_index=index;
    m_isAGroup=isAGroup;
    m_GroupNumber=groupNumber;
}


ItemItem::~ItemItem(){
}

int ItemItem::itemId(){
    return m_ItemId;
}

QString ItemItem::name(){
    return m_name;
}

int ItemItem::groupId(){
    return m_GroupId;
}

QString ItemItem::groupName(){
    return m_GroupName;
}

void ItemItem::setGroupId(int newGroupId){
    if (m_GroupId!=newGroupId){
        m_GroupId=newGroupId;
        emit dataChanged();
    }
}

void ItemItem::setGroupName(QString newGroupName){
    if (QString::compare(m_GroupName, newGroupName, Qt::CaseSensitive) != 0){
        m_GroupName=newGroupName;
        emit dataChanged();
    }
}

void ItemItem::setName(QString newName){
    if (QString::compare(m_name, newName, Qt::CaseSensitive) != 0){
        m_name=newName;
        emit dataChanged();
    }
}

int ItemItem::index(){
    return m_index;
}

bool ItemItem::isAGroup(){
    return m_isAGroup;
}

int ItemItem::groupNumber(){
    return m_GroupNumber;
}
